﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="umbPackage">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="info">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="package">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="name" type="xs:string" />
										<xs:element name="uniqueId" type="xs:string" />
										<xs:element name="version">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="major" type="xs:unsignedByte" />
													<xs:element name="minor" type="xs:unsignedByte" />
													<xs:element name="patch" type="xs:unsignedByte" />
												</xs:sequence>
											</xs:complexType>
										</xs:element>
										<xs:element name="license">
											<xs:complexType>
												<xs:simpleContent>
													<xs:extension base="xs:string">
														<xs:attribute name="url" type="xs:string" use="required" />
													</xs:extension>
												</xs:simpleContent>
											</xs:complexType>
										</xs:element>
										<xs:element name="url" type="xs:string" />
										<xs:element name="requirements">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="major" type="xs:unsignedByte" />
													<xs:element name="minor" type="xs:unsignedByte" />
													<xs:element name="patch" type="xs:unsignedByte" />
													<xs:element name="packages">
														<xs:complexType>
															<xs:sequence>
																<xs:element maxOccurs="unbounded" name="package">
																	<xs:complexType>
																		<xs:attribute name="guid" type="xs:string" use="required" />
																		<xs:attribute name="versionMajor" type="xs:unsignedByte" use="required" />
																		<xs:attribute name="versionMinor" type="xs:unsignedByte" use="required" />
																		<xs:attribute name="versionPatch" type="xs:unsignedByte" use="required" />
																	</xs:complexType>
																</xs:element>
															</xs:sequence>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
										<xs:element name="upgradeBehavior" type="upgradeBehaviorType" />
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="author">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="name" type="xs:string" />
										<xs:element name="website" type="xs:string" />
									</xs:sequence>
								</xs:complexType>
							</xs:element>
							<xs:element name="readme" type="xs:string" />
							<xs:element name="documentation">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="releaseNotes" type="xs:string" />
										<xs:element name="installation" type="xs:string" />
										<xs:element name="gettingStarted" type="xs:string" />
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="macros">
					<xs:complexType>
						<xs:sequence>
							<xs:element maxOccurs="unbounded" name="macro">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="name" type="xs:string" />
										<xs:element name="alias" type="xs:string" />
										<xs:element name="scriptType" />
										<xs:element name="scriptAssembly" />
										<xs:element name="xslt" type="xs:string" />
										<xs:element name="useInEditor" type="xs:boolean" />
										<xs:element name="refreshRate" type="xs:unsignedByte" />
										<xs:element minOccurs="0" name="properties">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="property">
														<xs:complexType>
															<xs:attribute name="show" type="xs:boolean" use="required" />
															<xs:attribute name="propertyType" type="xs:string" use="required" />
															<xs:attribute name="alias" type="xs:string" use="required" />
															<xs:attribute name="name" type="xs:string" use="required" />
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="files">
					<xs:complexType>
						<xs:sequence>
							<xs:element maxOccurs="unbounded" name="file">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="guid" type="xs:string" />
										<xs:element name="orgPath" type="xs:string" />
										<xs:element name="orgName" type="xs:string" />
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="commands" type="xs:string" />
				<xs:element name="control" type="xs:string" />
				<xs:element name="DocumentTypes">
					<xs:complexType>
						<xs:sequence>
							<xs:element maxOccurs="unbounded" name="DocumentType">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="Info">
											<xs:complexType>
												<xs:sequence>
													<xs:element name="Name" type="xs:string" />
													<xs:element name="Alias" type="xs:string" />
													<xs:element name="Icon" type="xs:string" />
													<xs:element name="Thumbnail" type="xs:string" />
													<xs:element name="Description" type="xs:string" />
													<xs:element name="AllowedTemplates">
														<xs:complexType>
															<xs:sequence>
																<xs:element name="Template" type="xs:string" />
															</xs:sequence>
														</xs:complexType>
													</xs:element>
													<xs:element name="DefaultTemplate" type="xs:string" />
												</xs:sequence>
											</xs:complexType>
										</xs:element>
										<xs:element name="Structure">
											<xs:complexType>
												<xs:sequence minOccurs="0">
													<xs:element name="DocumentType" type="xs:string" />
												</xs:sequence>
											</xs:complexType>
										</xs:element>
										<xs:element name="Tabs">
											<xs:complexType>
												<xs:sequence>
													<xs:element maxOccurs="unbounded" name="Tab">
														<xs:complexType>
															<xs:sequence>
																<xs:element name="Id" type="xs:unsignedByte" />
																<xs:element name="Caption" type="xs:string" />
															</xs:sequence>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
										<xs:element name="GenericProperties">
											<xs:complexType>
												<xs:sequence>
													<xs:element maxOccurs="unbounded" name="GenericProperty">
														<xs:complexType>
															<xs:sequence>
																<xs:element name="Name" type="xs:string" />
																<xs:element name="Alias" type="xs:string" />
																<xs:element name="Type" type="xs:string" />
																<xs:element name="Tab" type="xs:string" />
																<xs:element name="Mandatory" type="xs:string" />
																<xs:element name="Validation" />
																<xs:element name="Description" type="xs:string" />
															</xs:sequence>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Templates">
					<xs:complexType>
						<xs:sequence>
							<xs:element maxOccurs="unbounded" name="Template">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="Name" type="xs:string" />
										<xs:element name="Alias" type="xs:string" />
										<xs:element name="Master" type="xs:string" />
										<xs:element name="Design" type="xs:string" />
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Stylesheets">
					<xs:complexType>
						<xs:sequence>
							<xs:element maxOccurs="unbounded" name="Stylesheet">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="Name" type="xs:string" />
										<xs:element name="FileName" />
										<xs:element name="Content" type="xs:string" />
										<xs:element minOccurs="0" name="Properties">
											<xs:complexType>
												<xs:sequence>
													<xs:element maxOccurs="unbounded" name="Property">
														<xs:complexType>
															<xs:sequence>
																<xs:element name="Name" type="xs:string" />
																<xs:element name="Alias" type="xs:string" />
																<xs:element name="Value" type="xs:string" />
															</xs:sequence>
														</xs:complexType>
													</xs:element>
												</xs:sequence>
											</xs:complexType>
										</xs:element>
									</xs:sequence>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
				<xs:element name="Documents">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="DocumentSet">
								<xs:complexType>
									<xs:sequence>
										<xs:element name="node">
											<xs:complexType>
												<xs:sequence>
													<xs:element maxOccurs="unbounded" name="data">
														<xs:complexType>
															<xs:simpleContent>
																<xs:extension base="xs:string">
																	<xs:attribute name="versionID" type="xs:string" use="required" />
																	<xs:attribute name="alias" type="xs:string" use="required" />
																</xs:extension>
															</xs:simpleContent>
														</xs:complexType>
													</xs:element>
													<xs:element maxOccurs="unbounded" name="node">
														<xs:complexType>
															<xs:sequence>
																<xs:element maxOccurs="unbounded" name="data">
																	<xs:complexType>
																		<xs:simpleContent>
																			<xs:extension base="xs:string">
																				<xs:attribute name="versionID" type="xs:string" use="required" />
																				<xs:attribute name="alias" type="xs:string" use="required" />
																			</xs:extension>
																		</xs:simpleContent>
																	</xs:complexType>
																</xs:element>
																<xs:element minOccurs="0" maxOccurs="unbounded" name="node">
																	<xs:complexType>
																		<xs:sequence>
																			<xs:element maxOccurs="unbounded" name="data">
																				<xs:complexType>
																					<xs:simpleContent>
																						<xs:extension base="xs:string">
																							<xs:attribute name="versionID" type="xs:string" use="required" />
																							<xs:attribute name="alias" type="xs:string" use="required" />
																						</xs:extension>
																					</xs:simpleContent>
																				</xs:complexType>
																			</xs:element>
																		</xs:sequence>
																		<xs:attribute name="id" type="xs:unsignedShort" use="required" />
																		<xs:attribute name="version" type="xs:string" use="required" />
																		<xs:attribute name="parentID" type="xs:unsignedShort" use="required" />
																		<xs:attribute name="level" type="xs:unsignedByte" use="required" />
																		<xs:attribute name="writerID" type="xs:unsignedByte" use="required" />
																		<xs:attribute name="creatorID" type="xs:unsignedByte" use="required" />
																		<xs:attribute name="nodeType" type="xs:unsignedShort" use="required" />
																		<xs:attribute name="template" type="xs:unsignedShort" use="required" />
																		<xs:attribute name="sortOrder" type="xs:unsignedByte" use="required" />
																		<xs:attribute name="createDate" type="xs:dateTime" use="required" />
																		<xs:attribute name="updateDate" type="xs:dateTime" use="required" />
																		<xs:attribute name="nodeName" type="xs:string" use="required" />
																		<xs:attribute name="urlName" type="xs:string" use="required" />
																		<xs:attribute name="writerName" type="xs:string" use="required" />
																		<xs:attribute name="creatorName" type="xs:string" use="required" />
																		<xs:attribute name="nodeTypeAlias" type="xs:string" use="required" />
																		<xs:attribute name="path" type="xs:string" use="required" />
																	</xs:complexType>
																</xs:element>
															</xs:sequence>
															<xs:attribute name="id" type="xs:unsignedShort" use="required" />
															<xs:attribute name="version" type="xs:string" use="required" />
															<xs:attribute name="parentID" type="xs:unsignedShort" use="required" />
															<xs:attribute name="level" type="xs:unsignedByte" use="required" />
															<xs:attribute name="writerID" type="xs:unsignedByte" use="required" />
															<xs:attribute name="creatorID" type="xs:unsignedByte" use="required" />
															<xs:attribute name="nodeType" type="xs:unsignedShort" use="required" />
															<xs:attribute name="template" type="xs:unsignedShort" use="required" />
															<xs:attribute name="sortOrder" type="xs:unsignedByte" use="required" />
															<xs:attribute name="createDate" type="xs:dateTime" use="required" />
															<xs:attribute name="updateDate" type="xs:dateTime" use="required" />
															<xs:attribute name="nodeName" type="xs:string" use="required" />
															<xs:attribute name="urlName" type="xs:string" use="required" />
															<xs:attribute name="writerName" type="xs:string" use="required" />
															<xs:attribute name="creatorName" type="xs:string" use="required" />
															<xs:attribute name="nodeTypeAlias" type="xs:string" use="required" />
															<xs:attribute name="path" type="xs:string" use="required" />
														</xs:complexType>
													</xs:element>
												</xs:sequence>
												<xs:attribute name="id" type="xs:unsignedShort" use="required" />
												<xs:attribute name="version" type="xs:string" use="required" />
												<xs:attribute name="parentID" type="xs:byte" use="required" />
												<xs:attribute name="level" type="xs:unsignedByte" use="required" />
												<xs:attribute name="writerID" type="xs:unsignedByte" use="required" />
												<xs:attribute name="creatorID" type="xs:unsignedByte" use="required" />
												<xs:attribute name="nodeType" type="xs:unsignedShort" use="required" />
												<xs:attribute name="template" type="xs:unsignedShort" use="required" />
												<xs:attribute name="sortOrder" type="xs:unsignedByte" use="required" />
												<xs:attribute name="createDate" type="xs:dateTime" use="required" />
												<xs:attribute name="updateDate" type="xs:dateTime" use="required" />
												<xs:attribute name="nodeName" type="xs:string" use="required" />
												<xs:attribute name="urlName" type="xs:string" use="required" />
												<xs:attribute name="writerName" type="xs:string" use="required" />
												<xs:attribute name="creatorName" type="xs:string" use="required" />
												<xs:attribute name="nodeTypeAlias" type="xs:string" use="required" />
												<xs:attribute name="path" type="xs:string" use="required" />
											</xs:complexType>
										</xs:element>
									</xs:sequence>
									<xs:attribute name="importMode" type="importModeType" use="required" />
									<xs:attribute name="parentId" type="xs:unsignedByte"  use="optional" />
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:simpleType name = "importModeType">
		<xs:annotation>
			<xs:documentation>
				Decides how umbraco should import documents
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base = "xs:string">
			<xs:enumeration value = "root"/>
			<xs:enumeration value = "specified"/>
			<xs:enumeration value = "ask"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name = "upgradeBehaviorType">
		<xs:annotation>
			<xs:documentation>
				Decides how umbraco should handle if the package or any items with identical aliases/guids
							have been imported before
			</xs:documentation>
		</xs:annotation>
		<xs:restriction base = "xs:string">
			<xs:enumeration value = "overwrite"/>
			<xs:enumeration value = "duplicate"/>
			<xs:enumeration value = "abort"/>
		</xs:restriction>
	</xs:simpleType>
</xs:schema>